home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / BAG.H < prev    next >
C/C++ Source or Header  |  1993-04-27  |  2KB  |  44 lines

  1. #ifndef BAG_H
  2. #define BAG_H
  3.  
  4. #include "collect.h"
  5. #include "dict.h"
  6.  
  7. extern const Class class_Bag;
  8.  
  9. ////////////////////////////////////////////////////////////
  10. // class Bag (declaration)
  11. ////////////////////////////////////////////////////////////
  12. class Bag: public Collection {
  13.     unsigned    count;
  14.     Dictionary  contents;
  15. public:
  16.             // constructors, destructors
  17.             Bag(unsigned size =CLTN_DEFAULT_CAPACITY);
  18.             Bag(const Bag&);
  19.  
  20.             // operators
  21.     bool    operator!=(const Bag& a) const           { return !(*this==a); }
  22.     void    operator=(const Bag&);
  23.     bool    operator==(const Bag&) const;
  24.  
  25.     Object*                 addWithOccurrences(const Object&, unsigned);
  26.     virtual Object*         add(const Object&);
  27.     virtual Collection&     addContentsTo(Collection&) const;
  28.     virtual Object*&        at(int) const;
  29.     virtual unsigned        capacity() const;
  30.     virtual void            deepenShallowCopy();
  31.     virtual Object*         doNext(Iterator&) const;
  32.     virtual unsigned        hash() const;
  33.     virtual const Class*    isA() const;
  34.     virtual bool            isEqual(const Object&) const;
  35.     virtual unsigned        occurrencesOf(const Object&) const;
  36.     virtual void            printOn(ostream& strm) const;
  37.     virtual void            reSize(unsigned);
  38.     virtual Object*         remove(const Object&);
  39.     virtual unsigned        size() const;
  40.     virtual const Class*    species() const;
  41. };
  42.  
  43. #endif
  44.